from django.db import models

# Create your models here.
class BookInfo(models.Model):
    """图书信息：演示一对多，一方"""
    bname = models.CharField(max_length=20, verbose_name='书名')
    name = models.CharField(max_length=20, verbose_name='作者')
    hname = models.CharField(max_length=20, verbose_name='作者')
    bpub_date = models.DateField(verbose_name='发布日期')
    bread = models.IntegerField(default=0, verbose_name='阅读量')
    bcomment = models.IntegerField(default=0, verbose_name='评论量')
    is_delete = models.BooleanField(default=False, verbose_name='逻辑删除')

    class Meta:
        """模型类的元类：用于修改、配置模型类对应的数据表"""
        db_table = 'tb_books'  # 自定义数据库表名

    # def __str__(self):
    #     """定义每个数据对象的显示信息"""
    #     return self.bname # 输出该模型数据对象时，只输出书名